#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
    printf("begin:pid: %d,ppid : %d\n",getpid(),getppid());
    pid_t id =fork();
    if(id == 0)
    {
        printf("子进程:pid:%d,ppid:%d\n",getpid(),getppid());
    }
    else if (id > 0)
    {
        printf("父进程:pid:%d,ppid:%d\n",getpid(),getppid());
    }
    else
    {
        printf("error");
    }



   /* while(1)
    {
        printf("My pid is %d,My ppid is %d\n",getpid(),getppid());
        sleep(1);
    }*/
    return 0;
}
